<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
/*
|--------------------------------------------------------------------------
| 登录认证
|--------------------------------------------------------------------------
*/

Route::group(['middleware' => ['web']], function () {

    Route::get('/', function () {
        return view('welcome');
    });
    
    Route::auth();
    
});

/*
|--------------------------------------------------------------------------
| 后台路由
|--------------------------------------------------------------------------
*/
Route::group(['prefix'=>'system','middleware' => ['root']], function () {

    /*
    |--------------------------------------------------------------------------
    | 后台首页
    |--------------------------------------------------------------------------
    */
    Route::get('/','StatisticalController@total');

    /*
    |--------------------------------------------------------------------------
    | 库存管理
    |--------------------------------------------------------------------------
    */
    Route::get('store/history/{keyworld?}','StoreController@history');
    Route::get('store/{keyworld?}','StoreController@index');
    Route::get('store/{orderno}/{state}/allstore','StoreController@allstore');
    Route::get('store/{orderno}/{id}/{state}/store','StoreController@store');
    ;

    /*
    |--------------------------------------------------------------------------
    | 物品管理
    |--------------------------------------------------------------------------
    */
    Route::resource('goods',"GoodsController");

    /*
    |--------------------------------------------------------------------------
    | 搭配管理
    |--------------------------------------------------------------------------
    */
    Route::resource('box',"BoxController");
    Route::post('box/remark/','BoxController@ajaxremark');

    /*
    |--------------------------------------------------------------------------
    | 搭配管理
    |--------------------------------------------------------------------------
    */
    Route::resource('user',"UserController");

    /*
    |--------------------------------------------------------------------------
    | 字典表管理
    |--------------------------------------------------------------------------
    */
    Route::resource('dic',"DicController");

    /*
    |--------------------------------------------------------------------------
    | 数据批量入库
    |--------------------------------------------------------------------------
    */
    Route::get('bat/goods','BatchController@goods');

    /*
    |--------------------------------------------------------------------------
    | 搭配管理
    |--------------------------------------------------------------------------
    */
    Route::post('assort/check',"AssortController@checkstore");
    Route::post('assort/store',"AssortController@store");
    Route::get('assort/invoice',"AssortController@invoice");
    Route::get('assort/index',"AssortController@index");
    Route::get('assort/myboxs/{keyworld?}',"AssortController@showboxs");
    Route::get('assort/print/{orderno}',"AssortController@print");
    Route::get('assort/changestate/{orderno}',"AssortController@changestate");
    Route::post('assort/ajaxnumber',"AssortController@ajaxnumber");
    Route::post('assort/ajaxchangestate',"AssortController@ajaxchangestate");
    
    Route::get('assort/sublimt',function (){
        if(session('message')) {
            return view('system.assort.sublimtresult')->with('message',session('message'));

        }else{
            return view('system.assort.sublimtresult')->with('message','操作完毕');
        }
    });

    /*
    |--------------------------------------------------------------------------
    | 标签管理
    |--------------------------------------------------------------------------
    */
    Route::get('tags/ajaxlist',"TagsController@list");
    Route::post('tags/ajaxadd',"TagsController@add");
});